#define _CRT_SECURE_NO_WARNINGS 1


#include <stdio.h>

int main(void)
{
    char str[1000], * p, word[128] = { 0 };
    int e = 0, d = 0, s = 0, o = 0, i;

    while (scanf("%s,", str) != EOF)
    {
        p = str;
        do
        {
            word[*p]++;
            o++;
        } while (*(++p));
        word[0]++;
    }

    for (i = 'A'; i <= 'Z'; i++)  e += word[i] + word[i + 32];
    for (i = '0'; i <= '9'; i++)  d += word[i];

    printf("%d\r\n%d\r\n%d\r\n%d", e, word[0] - 1, d, o - e - d);
}